package com.zzh.phone.hviews;

import android.os.Bundle;
import android.widget.TextView;

import com.zzh.phone.hviews.adapter.EAdapter;
import com.zzh.phone.hviews.databinding.ActMoreListBinding;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * Created by ZZH on 2022/6/1.
 *
 * @Date: 2022/6/1
 * @Email: zzh_hz@126.com
 * @QQ: 1299234582
 * @Author: zzh
 * @Description:
 */
public class MoreListViewActivity extends AppCompatActivity {
    ActMoreListBinding bind;

    EAdapter mAdapter;

    TextView tv_status;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bind = ActMoreListBinding.inflate(getLayoutInflater());
        setContentView(bind.getRoot());
        mAdapter = new EAdapter();
        mAdapter.expandMore(true);
        bind.alv.setAdapter(mAdapter);

        bind.btn.setOnClickListener(v -> mAdapter.add("阿斯顿发送到发" + System.currentTimeMillis()));

        bind.del.setOnClickListener(v -> mAdapter.remove(0));


        bind.alv.getFootMoreView().setOnClickListener(v -> {
            if (mAdapter.isExpandMore()) {
                mAdapter.expandMore(false);
                //bind.alv.removeExpandMoreView();
            } else {
                mAdapter.expandMore(true);
            }
            mAdapter.notifyDataSetChanged();
        });

//        bind.reset.setOnClickListener(v -> bind.alv.resetExpandMoreView());


    }
}
